package main

import (
	"fmt"
)

// SimpleFile file reader
type SimpleFile interface {
	Read([]byte) (int, error)
	Write([]byte) (int, error)
	Close() error
}

// Reader file reader
type Reader interface {
	Read(p []byte) (n int, err error)
	Close() error
}

// Writer file writter
type Writer interface {
	Write(p []byte) (n int, err error)
	Close() error
}

// ReadWriter 联合结果 Read, Write, and Close.
type ReadWriter interface {
	Reader // includes methods of Reader in ReadWriter's method set
	Writer // includes methods of Writer in ReadWriter's method set
}

// 接口的定义
type CircleInterface interface {
	area() float64
}

// 接口的使用
func calcArea(c CircleInterface) float64 {
	return c.area()
}

func main() {
	// init: 初始化内部的字段（是用了字段的顺序）
	c4 := CircleStruct{0, 0, 5}

	// 调用接口的方法
	fmt.Println(calcArea(&c4))
}
